<%--
  Created by IntelliJ IDEA.
  User: Miles麦
  Date: 2018/12/29
  Time: 15:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--<%--%>
    <%--String path = request.getContextPath();--%>
    <%--String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";--%>
<%--%>--%>
<html>
<head>
    <title>用户信息管理</title>
    <script type="text/javascript" src="../../../static/js/jquery-3.3.1.min.js"></script>
    <script>
        $(document).ready(function () {
            var id = '<%= session.getAttribute("userId")%>'
            $.post('/sys-user/getUser',{id:id},function (user) {
                console.log("name:"+user.data.userName);
                $('#name').val(user.data.userName);
                $('#pw').val(user.data.pwd);
                $('#phone').val(user.data.telephone);
                $('#email').val(user.data.email);
            });
            $('#submit').click(function () {
                var username = $('#name').val();
                var pw = $('#pw').val();
                var phone = $('#phone').val();
                var email = $('#email').val();
                console.log(typeof username);
                var id = '<%= session.getAttribute("userId")%>';
                var part = '<%= session.getAttribute("part")%>';
                console.log(id);
                $.post('/sys-user/modify',
                {
                    userId:id,
                    userName:username,
                    pwd:pw,
                    part:part,
                    telephone:phone,
                    email:email,
                  }
                );
            });
        });
    </script>
</head>
<body>
    <div id="div1">
        <div id="username">
            <p>用户名</p><input id="name" type="text">
        </div>
        <div id="userpw">
            <p>密码</p><input id="pw" type="password">
        </div>
        <div id="userphone">
            <p>电话</p><input id="phone" type="text">
        </div>
        <div id="useremail">
            <p>电子邮箱</p><input id="email" type="text">
        </div>
        <div>
            <button  id="submit">确认修改</button>
        </div>
    </div>
</body>
</html>
